using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class ConfigItem
{
    public static Dictionary<int, ConfigItemElement> id2Element;

    public static ConfigItemElement GetElement(int id)
    {
        ConfigItemElement item;
        if (!id2Element.TryGetValue(id, out item)) {
            Debug.LogError("ConfigItem Can not find id:" + id);
         }
        return item;
    }

    static ConfigItem()
    {
        id2Element = new Dictionary<int, ConfigItemElement>();
        var list = new List<ConfigItemElement>() {
            new ConfigItemElement() { Id = ItemDef.TypeIdWater, PrefabName = "PF Props Pot A", SpriteName = "TX Props", SpriteSubName = "TX Props Pot A"},
            new ConfigItemElement() { Id = ItemDef.TypeIdBrick, PrefabName = "PF Props Brick T3", SpriteName = "TX Props", SpriteSubName = "TX Props Brick T3"},
        };
        foreach (var elem in list)
        {
            id2Element[elem.Id] = elem;
        }
    }
}